package com.chris.code.generate.manager;

import com.chris.assist.builders.springboot.supports.SpringbootTemplatePaths;
import com.chris.assist.common.templates.AndroidTemplatePaths;
import com.chris.assist.common.templates.ResourceMode;
import com.chris.assist.common.templates.VueTemplatePaths;

/**
 * @author Chris Chan
 * Create On 2025/9/16 下午5:54
 * Use for: 类路径资源管理类
 * Explain:
 * 特别规范：
 * 2025-10-18
 * 为了使ClassPath模式与File模式的资源路径保持逻辑一致
 * 资源路径都从templates开始
 * ClassPath模式不设置rootPath
 * File模式的rootPath是templates的上层目录
 */
public class CustomFileResourceManager {
    /**
     * 获取springboot模版文件路径
     *
     * @return
     */
    public static SpringbootTemplatePaths getSpringboot() {
        SpringbootTemplatePaths paths = new SpringbootTemplatePaths();
        paths.resourceMode = ResourceMode.CLASSPATH;
        String pathPrefix = "templates/springboot/";

        // 类文档备注
        paths.classDocRemark = pathPrefix + "class_doc_remark.vm";

        // MVC
        paths.mvc.entity.entity = pathPrefix + "entity.vm";
        paths.mvc.repository.repository = pathPrefix + "repository.vm";
        paths.mvc.service.service = pathPrefix + "service.vm";
        paths.mvc.service.serviceImpl = pathPrefix + "service_impl.vm";
        paths.mvc.service.assistant = pathPrefix + "service_assistant.vm";
        paths.mvc.service.converter = pathPrefix + "service_assistant_converter.vm";
        paths.mvc.web.api = pathPrefix + "web_api.vm";
        paths.mvc.web.controller = pathPrefix + "web_controller.vm";
        paths.mvc.models.createParam = pathPrefix + "web_param_create.vm";
        paths.mvc.models.updateParam = pathPrefix + "web_param_update.vm";
        paths.mvc.models.searchParam = pathPrefix + "web_param_search.vm";
        paths.mvc.models.orderParam = pathPrefix + "web_param_order.vm";
        paths.mvc.models.result = pathPrefix + "web_result.vm";

        return paths;
    }

    /**
     * 获取vue模版文件路径
     *
     * @return
     */
    public static VueTemplatePaths getVue() {
        VueTemplatePaths paths = new VueTemplatePaths();
        paths.resourceMode = ResourceMode.CLASSPATH;
        String pathPrefix = "templates/vue/";

        paths.type = pathPrefix + "type/type.vm";
        paths.apis = pathPrefix + "api/apis.vm";
        paths.page = pathPrefix + "page/page.vm";
        paths.router = pathPrefix + "router/router.vm";

        return paths;
    }

    /**
     * 获取android模版文件路径
     *
     * @return
     */
    public static AndroidTemplatePaths getAndroid() {
        AndroidTemplatePaths paths = new AndroidTemplatePaths();
        paths.resourceMode = ResourceMode.CLASSPATH;
        String pathPrefix = "templates/app/android/";


        //数据模型
        paths.models.createParam = pathPrefix + "model/web_param_create.vm";
        paths.models.updateParam = pathPrefix + "model/web_param_update.vm";
        paths.models.createOrUpdateParam = pathPrefix + "model/web_param_create_or_update.vm";
        paths.models.searchParam = pathPrefix + "model/web_param_search.vm";
        paths.models.orderParam = pathPrefix + "model/web_param_order.vm";
        paths.models.result = pathPrefix + "model/web_result.vm";
        // 接口
        paths.apis.apis = pathPrefix + "api/apis.vm";
        paths.apis.simpleApis = pathPrefix + "api/apis-simple.vm";

        // Mvpp页面
        paths.mvpp.layout = pathPrefix + "mvpp/layout.vm";
        paths.mvpp.classDocRemark = pathPrefix + "mvpp/class_doc_remark.vm";
        paths.mvpp.activity = pathPrefix + "mvpp/activity.vm";
        paths.mvpp.fragment = pathPrefix + "mvpp/fragment.vm";
        paths.mvpp.contract = pathPrefix + "mvpp/contract.vm";
        paths.mvpp.presenter = pathPrefix + "mvpp/presenter.vm";
        paths.mvpp.activityViewProxy = pathPrefix + "mvpp/activity_view_proxy.vm";
        paths.mvpp.fragmentViewProxy = pathPrefix + "mvpp/fragment_view_proxy.vm";
        paths.mvpp.viewModel = pathPrefix + "mvpp/view_model.vm";
        paths.mvpp.viewHolders = pathPrefix + "mvpp/view_holders.vm";
        paths.mvpp.defaultViewHolders = pathPrefix + "mvpp/view_holders_default.vm";
        paths.mvpp.mainViewHolder = pathPrefix + "mvpp/main_view_holder.vm";
        paths.mvpp.recViewHolder = pathPrefix + "mvpp/rec_view_holder.vm";
        paths.mvpp.adapterManager = pathPrefix + "mvpp/adapter_manager.vm";
        paths.mvpp.adapterManagerMethod = pathPrefix + "mvpp/adapter_create_method.vm";
        paths.mvpp.buildInfo = pathPrefix + "info/build_info.vm";

        return paths;
    }
}
